﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Imaginecup.gameState.recycling.Observable;
using System.Collections;

namespace Imaginecup.gameState.recycling.Entity
{
    public class GroupButtonData : IObservable
    {
        private List<IMyObserver> m_ObserverList;
        public IList GetObserver()
        {
            return m_ObserverList;
        }

        public GroupButtonData()
        {
            m_ObserverList = new List<IMyObserver>();
        }

        public void AddObserver(IMyObserver observer)
        {
            if (!m_ObserverList.Contains(observer))
                m_ObserverList.Add(observer);
        }

        public void DeleteObserver(IMyObserver observer)
        {
            if (m_ObserverList.Contains(observer))
                m_ObserverList.Remove(observer);
        }

        public void NotifyObservers(object obj)
        {
            foreach (IMyObserver observerItem in m_ObserverList)
            {
                observerItem.Update(this, obj);
            }
        }
    }
}
